#include <iostream>

using namespace std;

struct comple 
{
    double r,i;
};

struct comple f1(struct comple a,struct comple b);
struct comple f2(struct comple a,struct comple b);
struct comple f3(struct comple a,struct comple b);


int main ( )
{
    struct comple a[2],c;
    int i;

    cout<<"enter the complex of a,b:"<<endl;

    for(i=0;i<2;i++)
    {
        cout<<"enter the "<<i<<"number"<<endl;
        cin>>a[i].r>>a[i].i;
    }


    c=f1(a[0],a[1]);
    cout<<c.r<<" "<<c.i<<endl;


    c=f2(a[0],a[1]);
    cout<<c.r<<" "<<c.i<<endl;


    c=f3(a[0],a[1]);
    cout<<c.r<<" "<<c.i<<endl;

    cin>>i;
    return 0;
}

struct comple f1(struct comple a,struct comple b)
{
    struct comple sa;

    sa.r=a.r+b.r;
    sa.i=a.i+b.i;

    return sa;
}

struct comple f2(struct comple a,struct comple b)
{
    struct comple sa;

    sa.r=a.r-b.r;
    sa.i=a.i-b.i;

    return sa;
}

struct comple f3(struct comple a,struct comple b)
{
    struct comple sa;
    int i;

    sa.r=a.r-b.r;
    i=a.i*b.i;
    sa.r=sa.r-i;
    sa.i=0;

    return sa;

}

